describe('practice-4-4', function () {

    it("将真分数分解为埃及分数", function () {
        var proper_fraction = {numerator:3,denominator:5};
        var arr_result = proper_fraction_to_egyptian_fractions(proper_fraction);

        expect(sum_fraction(arr_result)).toBe(3/5);

        var arr_result_temp = proper_fraction_to_egyptian_fractions({numerator:132,denominator:155});
        expect(sum_fraction(arr_result_temp)).toBe(132/155);

        var arr_fraction = proper_fraction_to_egyptian_fractions({numerator:8,denominator:15});
        expect(sum_fraction(arr_fraction)).toBe(8/15);
    });

});
function sum_fraction(arr_result)
{
    var sum_fraction = 0;
    for(var i = 0; i < arr_result.length; i ++)
    {
        sum_fraction += 1/arr_result[i];
    }
    return sum_fraction;
}